package www.bplead.com.mydemo;

import android.app.Application;
import android.content.Context;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

import roboguice.RoboGuice;
import www.bplead.com.controller.action.student.StudentAction;
import www.bplead.com.controller.action.upload.FileUploadAction;
import www.bplead.com.controller.action.user.UserAction;

/**
 * Created by wangyangzi on 2016/9/3.
 */
public class MyApplication extends Application {
    private UserAction userAction;
    private FileUploadAction fileUploadAction;
    private StudentAction studentAction;

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
    }

    @Override
    public void onCreate() {
        super.onCreate();

        registerAction();

        //创建默认的ImageLoader配置参数
        ImageLoaderConfiguration configuration = ImageLoaderConfiguration
                .createDefault(this);

        /*ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this)
                .writeDebugLogs() //打印log信息
                .build();*/

        //Initialize ImageLoader with configuration.
        ImageLoader.getInstance().init(configuration);
    }

    private void registerAction() {
        userAction = RoboGuice.getInjector(getApplicationContext()).getInstance(UserAction.class);
        fileUploadAction = RoboGuice.getInjector(getApplicationContext()).getInstance(FileUploadAction.class);
        studentAction = RoboGuice.getInjector(getApplicationContext()).getInstance(StudentAction.class);
    }
}
